package com.takeoutsystem.event.message;

import com.takeoutsystem.bean.StorageRemainShow;
import org.springframework.context.ApplicationEvent;


import java.text.SimpleDateFormat;
import java.util.TimeZone;


public class TimeOutMailEvent extends ApplicationEvent {

    private StorageRemainShow orderInfo;

    public TimeOutMailEvent(Object source,StorageRemainShow orderInfo) {
        super(source);
        this.orderInfo=orderInfo;
    }

    public StorageRemainShow getOrderInfo() {
        return orderInfo;
    }

    public void setOrderInfo(StorageRemainShow orderInfo) {
        this.orderInfo = orderInfo;
    }


    public String generateMailContent(){
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
        return "【饿团外卖】您于"+dateFormat.format(orderInfo.getInTime())+"存放于自提柜"+orderInfo.getCabId()+"的外卖,因存放超过12h被清除!";
    }

}
